Passed
Push — task/relative-resources ( d91573...a75d4d )
by Tristan
04:18
created

lookupConstants.ts ➔ enumToIds   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
export enum ReviewStatusId {
2
  ScreenedOut = 1,
3
  StillThinking = 2,
4
  StillIn = 3,
5
}
6
7
export type ReviewStatusName = "screened_out" | "still_thinking" | "still_in";
8
9
export enum ResponseReviewStatusId {
10
  ScreenedOut = 1,
11
  ReadyForReference = 4,
12
  ReadyToAllocate = 5,
13
  AssessmentRequired = 6,
14
  Allocated = 7,
15
  NotAvailable = 8,
16
}
17
18
export type ResponseReviewStatusName =
19
  | "screened_out"
20
  | "ready_for_reference"
21
  | "ready_to_allocate"
22
  | "assessment_required"
23
  | "allocated"
24
  | "not_available";
25
26
export type ResponseReviewStatus = {
27
  id: ResponseReviewStatusId;
28
  name: ResponseReviewStatusName;
29
};
30
31
export enum ExcludedDepartments {
32
  StrategicTalentResponse = 18,
33
}
34
35
export enum CriteriaTypeId {
36
  Essential = 1,
37
  Asset = 2,
38
}
39
40
export enum SkillTypeId {
41
  Soft = 1,
42
  Hard = 2,
43
}
44
45
export enum SkillLevelId {
46
  Basic = 1,
47
  Intermediate = 2,
48
  Advanced = 3,
49
  Expert = 4,
50
}
51
52
export enum AssessmentTypeId {
53
  NarrativeAssessment = 1,
54
  ApplicationScreeningQuestion = 2,
55
  GroupTest = 3,
56
  InformalPhoneConversation = 4,
57
  Interview = 5,
58
  OnlineExam = 6,
59
  OnSiteExam = 7,
60
  TakeHomeExam = 8,
61
  PortfolioReview = 9,
62
  ReferenceCheck = 10,
63
  SeriousGames = 11,
64
}
65
66
export const ProvinceId = {
67
  AB: 1,
68
  BC: 2,
69
  MB: 3,
70
  NL: 4,
71
  NB: 5,
72
  NS: 6,
73
  NU: 7,
74
  NT: 8,
75
  ON: 9,
76
  PE: 10,
77
  QC: 11,
78
  SK: 12,
79
  YT: 13,
80
};
81
82
export const SecurityClearanceId = {
83
  reliability: 1,
84
  secret: 2,
85
  topSecret: 3,
86
};
87
88
export const LanguageRequirementId = {
89
  english: 1,
90
  french: 2,
91
  bilingualIntermediate: 3,
92
  bilingualAdvanced: 4,
93
  englishOrFrench: 5,
94
};
95
96
export const FrequencyId = {
97
  never: 1,
98
  rarely: 2,
99
  sometimes: 3,
100
  often: 4,
101
  always: 5,
102
};
103
104
export const TravelRequirementId = {
105
  frequently: 1,
106
  available: 2,
107
  none: 3,
108
};
109
110
export const OvertimeRequirementId = {
111
  frequently: 1,
112
  available: 2,
113
  none: 3,
114
};
115
116
export const ClassificationId = {
117
  AS: 1,
118
  BI: 2,
119
  CO: 3,
120
  CR: 4,
121
  CS: 5,
122
  EC: 6,
123
  EX: 7,
124
  FO: 8,
125
  IS: 9,
126
  PC: 10,
127
  PE: 11,
128
  PM: 12,
129
  AD: 13,
130
};
131
132
export const CommentTypeId = {
133
  question: 1,
134
  recommendation: 2,
135
  requiredAction: 3,
136
};
137
138
export const LocationId = {
139
  jobGeneric: "job/generic",
140
  heading: "job/heading",
141
  basicInfo: "job/basicInfo",
142
  impact: "job/impact",
143
  tasks: "job/tasks",
144
  skills: "job/skills",
145
  langRequirements: "job/langRequirements",
146
  environment: "job/environment",
147
  summary: "hr/summary",
148
  preview: "hr/preview",
149
  screeningPlan: "screeningPlan/generic",
150
  screeningPlanBuilder: "screeningPlan/builder",
151
  screeningPlanSummary: "screeningPlan/summary",
152
  screeningPlanRatings: "screeningPlan/ratings",
153
  applicantsGeneric: "applicants/generic",
154
  underConsideration: "applicants/underConsideration",
155
  optionalConsideration: "applicants/optionalConsideration",
156
  notUnderConsideration: "applicants/notUnderConsideration",
157
} as const;
158
159
export enum JobStatus {
160
  Draft = "draft",
161
  ReviewManager = "review_manager",
162
  ReviewHr = "review_hr",
163
  Translation = "translation",
164
  FinalReviewManager = "final_review_manager",
165
  FinalReviewHr = "final_review_hr",
166
  PendingApproval = "pending_approval",
167
  Approved = "approved",
168
  Ready = "ready",
169
  Live = "live",
170
  Assessment = "assessment",
171
  Completed = "completed",
172
}
173
174
export enum ResponseScreeningBuckets {
175
  Consideration = "consideration",
176
  ReadyToAllocate = "ready_to_allocate",
177
  Allocated = "allocated",
178
  Unavailable = "unavailable",
179
  DoesNotQualify = "does_not_qualify",
180
}
181
182
export function getKeyByValue(object, value): string {
183
  return (
184
    Object.keys(object).find((key) => object[key] === parseInt(value, 10)) || ""
185
  );
186
}
187
188
export function enumToIds(enumType: object): number[] {
189
  const enumVals = Object.values(enumType);
190
  // Note: this first array includes the list of ids as strings, followed by the list of names as strings
191
  const enumIds = enumVals.filter((item) => !Number.isNaN(Number(item)));
192
  return enumIds.map((id) => Number(id));
193
}
194
195
export const SkillLevelIdValues = enumToIds(SkillLevelId);
196
197
export const SkillTypeIdValues = enumToIds(SkillTypeId);
198
199
export const AssessmentTypeIdValues = enumToIds(AssessmentTypeId);
200
201
export const CriteriaTypeIdValues = enumToIds(CriteriaTypeId);
202